import java.util.Arrays;


public class SDSDSD {

	public static void main(String[] args) {
		String s="this is a test ";
		String ss[]=s.split(" ");
		//test a is this 
		for(int i=ss.length-1;i>=0;i--){
		   System.out.print(ss[i]+" ");
		}   
		int[] o={1,6,3,6,1};
		sort(0,4,o);
		System.out.println(Arrays.toString(o));
		
	}
	
	public static  void sort(int left,int right,int[] array){
		int l=left;
		int r=right;
		int prvot=array[(left+right)/2];
		int temp=0;
	    while(l<r){
		   while(array[l]<prvot) l++;
		   while(array[r]>right) r--;
		   if(l>=r) break;
		   
		   temp=array[l];
		   array[l]=array[r];
		   array[r]=temp;

		   if(array[l]==prvot) --r;
		   if(array[r]==prvot) ++l;
		   System.out.println("l="+l);
		   System.out.println("r="+r);
		}
	    if(l==r){
	    	l++;
	    	r++;
	    	}
	}
}
